import React from 'react';
import { connect } from 'dva';
import 'antd-mobile/dist/antd-mobile.css';
import Banner from "../components/Banner";
import PriceForm from "../components/PriceForm";
import { routerRedux } from 'dva/router';

@connect(({ cars }) => ({
  store: cars,
}))


export default class  IndexPage extends React.Component{

  saveForm = d=>{
    console.log(d);
    this.props.dispatch({
      type:'cars/save_formData',
      payload: d
    })
  }

  render(){
    return (
      <div>
        <Banner/>
        <PriceForm
          store={this.props.store}
          saveForm={this.saveForm}
          brandList={()=>{
            this.props.dispatch(routerRedux.push('/brandlist'));
          }}
          search={()=>{
            this.props.dispatch(routerRedux.push('/detail'));
        }}/>
      </div>
    );
  }
}
